package com.sunny.thread; /**
 * Created by Sunny on 2016/11/16.
 */

/**
 * 类变量
 *
 * @author sunc
 * @date 2016-11-16-9:52
 */
public class HasSelfPrivateNum {

    private int num =0 ;

   synchronized public void addI(String name)  {
       try {
           if (name.equals("a")) {
               num = 100;
               System.out.println("a set over");
               Thread.sleep(200);
           } else {
               num = 200;
               System.out.println("b set over");
           }
           System.out.println(name+" ,num="+num);
       }catch (InterruptedException e){
           e.printStackTrace();
       }
    }

 }
